package cn.maihe.elg.operation.centers.fuzhou.enums;

import java.util.Arrays;

/**
 * @Description
 * @Author WJH
 * @Date 2021/07/12
 */
public enum HyMakeRespCodeEnum {
    SUCCESS("0", "成功"),
    FAILURE("99", "失败");
    private String respCode;
    private String respDesc;

    HyMakeRespCodeEnum(String respCode, String respDesc) {
        this.respCode = respCode;
        this.respDesc = respDesc;
    }

    public String getRespCode() {
        return respCode;
    }

    public String getRespDesc() {
        return respDesc;
    }

    public static HyMakeRespCodeEnum resolve(String respCode) {
        return Arrays.stream(values()).filter(cur -> cur.respCode.equals(respCode)).findFirst().orElseThrow(() -> new RuntimeException("未识别的响应码[" + respCode + "]"));
    }

    public static boolean isSuccess(String respCode){
        return SUCCESS.getRespCode().equals(respCode);
    }
}
